// Author: Neha Jawalkar
// Copyright:
//
// Copyright (c) 2024 Microsoft Research
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include "utils/gpu_data_types.h"

#define AES_128_TABLE_SIZE 256

u8 Sbox_g[256] = {0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16};

u32 T0[AES_128_TABLE_SIZE] = {
	0xc66363a5U,
	0xf87c7c84U,
	0xee777799U,
	0xf67b7b8dU,
	0xfff2f20dU,
	0xd66b6bbdU,
	0xde6f6fb1U,
	0x91c5c554U,
	0x60303050U,
	0x02010103U,
	0xce6767a9U,
	0x562b2b7dU,
	0xe7fefe19U,
	0xb5d7d762U,
	0x4dababe6U,
	0xec76769aU,
	0x8fcaca45U,
	0x1f82829dU,
	0x89c9c940U,
	0xfa7d7d87U,
	0xeffafa15U,
	0xb25959ebU,
	0x8e4747c9U,
	0xfbf0f00bU,
	0x41adadecU,
	0xb3d4d467U,
	0x5fa2a2fdU,
	0x45afafeaU,
	0x239c9cbfU,
	0x53a4a4f7U,
	0xe4727296U,
	0x9bc0c05bU,
	0x75b7b7c2U,
	0xe1fdfd1cU,
	0x3d9393aeU,
	0x4c26266aU,
	0x6c36365aU,
	0x7e3f3f41U,
	0xf5f7f702U,
	0x83cccc4fU,
	0x6834345cU,
	0x51a5a5f4U,
	0xd1e5e534U,
	0xf9f1f108U,
	0xe2717193U,
	0xabd8d873U,
	0x62313153U,
	0x2a15153fU,
	0x0804040cU,
	0x95c7c752U,
	0x46232365U,
	0x9dc3c35eU,
	0x30181828U,
	0x379696a1U,
	0x0a05050fU,
	0x2f9a9ab5U,
	0x0e070709U,
	0x24121236U,
	0x1b80809bU,
	0xdfe2e23dU,
	0xcdebeb26U,
	0x4e272769U,
	0x7fb2b2cdU,
	0xea75759fU,
	0x1209091bU,
	0x1d83839eU,
	0x582c2c74U,
	0x341a1a2eU,
	0x361b1b2dU,
	0xdc6e6eb2U,
	0xb45a5aeeU,
	0x5ba0a0fbU,
	0xa45252f6U,
	0x763b3b4dU,
	0xb7d6d661U,
	0x7db3b3ceU,
	0x5229297bU,
	0xdde3e33eU,
	0x5e2f2f71U,
	0x13848497U,
	0xa65353f5U,
	0xb9d1d168U,
	0x00000000U,
	0xc1eded2cU,
	0x40202060U,
	0xe3fcfc1fU,
	0x79b1b1c8U,
	0xb65b5bedU,
	0xd46a6abeU,
	0x8dcbcb46U,
	0x67bebed9U,
	0x7239394bU,
	0x944a4adeU,
	0x984c4cd4U,
	0xb05858e8U,
	0x85cfcf4aU,
	0xbbd0d06bU,
	0xc5efef2aU,
	0x4faaaae5U,
	0xedfbfb16U,
	0x864343c5U,
	0x9a4d4dd7U,
	0x66333355U,
	0x11858594U,
	0x8a4545cfU,
	0xe9f9f910U,
	0x04020206U,
	0xfe7f7f81U,
	0xa05050f0U,
	0x783c3c44U,
	0x259f9fbaU,
	0x4ba8a8e3U,
	0xa25151f3U,
	0x5da3a3feU,
	0x804040c0U,
	0x058f8f8aU,
	0x3f9292adU,
	0x219d9dbcU,
	0x70383848U,
	0xf1f5f504U,
	0x63bcbcdfU,
	0x77b6b6c1U,
	0xafdada75U,
	0x42212163U,
	0x20101030U,
	0xe5ffff1aU,
	0xfdf3f30eU,
	0xbfd2d26dU,
	0x81cdcd4cU,
	0x180c0c14U,
	0x26131335U,
	0xc3ecec2fU,
	0xbe5f5fe1U,
	0x359797a2U,
	0x884444ccU,
	0x2e171739U,
	0x93c4c457U,
	0x55a7a7f2U,
	0xfc7e7e82U,
	0x7a3d3d47U,
	0xc86464acU,
	0xba5d5de7U,
	0x3219192bU,
	0xe6737395U,
	0xc06060a0U,
	0x19818198U,
	0x9e4f4fd1U,
	0xa3dcdc7fU,
	0x44222266U,
	0x542a2a7eU,
	0x3b9090abU,
	0x0b888883U,
	0x8c4646caU,
	0xc7eeee29U,
	0x6bb8b8d3U,
	0x2814143cU,
	0xa7dede79U,
	0xbc5e5ee2U,
	0x160b0b1dU,
	0xaddbdb76U,
	0xdbe0e03bU,
	0x64323256U,
	0x743a3a4eU,
	0x140a0a1eU,
	0x924949dbU,
	0x0c06060aU,
	0x4824246cU,
	0xb85c5ce4U,
	0x9fc2c25dU,
	0xbdd3d36eU,
	0x43acacefU,
	0xc46262a6U,
	0x399191a8U,
	0x319595a4U,
	0xd3e4e437U,
	0xf279798bU,
	0xd5e7e732U,
	0x8bc8c843U,
	0x6e373759U,
	0xda6d6db7U,
	0x018d8d8cU,
	0xb1d5d564U,
	0x9c4e4ed2U,
	0x49a9a9e0U,
	0xd86c6cb4U,
	0xac5656faU,
	0xf3f4f407U,
	0xcfeaea25U,
	0xca6565afU,
	0xf47a7a8eU,
	0x47aeaee9U,
	0x10080818U,
	0x6fbabad5U,
	0xf0787888U,
	0x4a25256fU,
	0x5c2e2e72U,
	0x381c1c24U,
	0x57a6a6f1U,
	0x73b4b4c7U,
	0x97c6c651U,
	0xcbe8e823U,
	0xa1dddd7cU,
	0xe874749cU,
	0x3e1f1f21U,
	0x964b4bddU,
	0x61bdbddcU,
	0x0d8b8b86U,
	0x0f8a8a85U,
	0xe0707090U,
	0x7c3e3e42U,
	0x71b5b5c4U,
	0xcc6666aaU,
	0x904848d8U,
	0x06030305U,
	0xf7f6f601U,
	0x1c0e0e12U,
	0xc26161a3U,
	0x6a35355fU,
	0xae5757f9U,
	0x69b9b9d0U,
	0x17868691U,
	0x99c1c158U,
	0x3a1d1d27U,
	0x279e9eb9U,
	0xd9e1e138U,
	0xebf8f813U,
	0x2b9898b3U,
	0x22111133U,
	0xd26969bbU,
	0xa9d9d970U,
	0x078e8e89U,
	0x339494a7U,
	0x2d9b9bb6U,
	0x3c1e1e22U,
	0x15878792U,
	0xc9e9e920U,
	0x87cece49U,
	0xaa5555ffU,
	0x50282878U,
	0xa5dfdf7aU,
	0x038c8c8fU,
	0x59a1a1f8U,
	0x09898980U,
	0x1a0d0d17U,
	0x65bfbfdaU,
	0xd7e6e631U,
	0x844242c6U,
	0xd06868b8U,
	0x824141c3U,
	0x299999b0U,
	0x5a2d2d77U,
	0x1e0f0f11U,
	0x7bb0b0cbU,
	0xa85454fcU,
	0x6dbbbbd6U,
	0x2c16163aU,
};
u32 T4_0[AES_128_TABLE_SIZE] = {
	0x00000063U,
	0x0000007cU,
	0x00000077U,
	0x0000007bU,
	0x000000f2U,
	0x0000006bU,
	0x0000006fU,
	0x000000c5U,
	0x00000030U,
	0x00000001U,
	0x00000067U,
	0x0000002bU,
	0x000000feU,
	0x000000d7U,
	0x000000abU,
	0x00000076U,
	0x000000caU,
	0x00000082U,
	0x000000c9U,
	0x0000007dU,
	0x000000faU,
	0x00000059U,
	0x00000047U,
	0x000000f0U,
	0x000000adU,
	0x000000d4U,
	0x000000a2U,
	0x000000afU,
	0x0000009cU,
	0x000000a4U,
	0x00000072U,
	0x000000c0U,
	0x000000b7U,
	0x000000fdU,
	0x00000093U,
	0x00000026U,
	0x00000036U,
	0x0000003fU,
	0x000000f7U,
	0x000000ccU,
	0x00000034U,
	0x000000a5U,
	0x000000e5U,
	0x000000f1U,
	0x00000071U,
	0x000000d8U,
	0x00000031U,
	0x00000015U,
	0x00000004U,
	0x000000c7U,
	0x00000023U,
	0x000000c3U,
	0x00000018U,
	0x00000096U,
	0x00000005U,
	0x0000009aU,
	0x00000007U,
	0x00000012U,
	0x00000080U,
	0x000000e2U,
	0x000000ebU,
	0x00000027U,
	0x000000b2U,
	0x00000075U,
	0x00000009U,
	0x00000083U,
	0x0000002cU,
	0x0000001aU,
	0x0000001bU,
	0x0000006eU,
	0x0000005aU,
	0x000000a0U,
	0x00000052U,
	0x0000003bU,
	0x000000d6U,
	0x000000b3U,
	0x00000029U,
	0x000000e3U,
	0x0000002fU,
	0x00000084U,
	0x00000053U,
	0x000000d1U,
	0x00000000U,
	0x000000edU,
	0x00000020U,
	0x000000fcU,
	0x000000b1U,
	0x0000005bU,
	0x0000006aU,
	0x000000cbU,
	0x000000beU,
	0x00000039U,
	0x0000004aU,
	0x0000004cU,
	0x00000058U,
	0x000000cfU,
	0x000000d0U,
	0x000000efU,
	0x000000aaU,
	0x000000fbU,
	0x00000043U,
	0x0000004dU,
	0x00000033U,
	0x00000085U,
	0x00000045U,
	0x000000f9U,
	0x00000002U,
	0x0000007fU,
	0x00000050U,
	0x0000003cU,
	0x0000009fU,
	0x000000a8U,
	0x00000051U,
	0x000000a3U,
	0x00000040U,
	0x0000008fU,
	0x00000092U,
	0x0000009dU,
	0x00000038U,
	0x000000f5U,
	0x000000bcU,
	0x000000b6U,
	0x000000daU,
	0x00000021U,
	0x00000010U,
	0x000000ffU,
	0x000000f3U,
	0x000000d2U,
	0x000000cdU,
	0x0000000cU,
	0x00000013U,
	0x000000ecU,
	0x0000005fU,
	0x00000097U,
	0x00000044U,
	0x00000017U,
	0x000000c4U,
	0x000000a7U,
	0x0000007eU,
	0x0000003dU,
	0x00000064U,
	0x0000005dU,
	0x00000019U,
	0x00000073U,
	0x00000060U,
	0x00000081U,
	0x0000004fU,
	0x000000dcU,
	0x00000022U,
	0x0000002aU,
	0x00000090U,
	0x00000088U,
	0x00000046U,
	0x000000eeU,
	0x000000b8U,
	0x00000014U,
	0x000000deU,
	0x0000005eU,
	0x0000000bU,
	0x000000dbU,
	0x000000e0U,
	0x00000032U,
	0x0000003aU,
	0x0000000aU,
	0x00000049U,
	0x00000006U,
	0x00000024U,
	0x0000005cU,
	0x000000c2U,
	0x000000d3U,
	0x000000acU,
	0x00000062U,
	0x00000091U,
	0x00000095U,
	0x000000e4U,
	0x00000079U,
	0x000000e7U,
	0x000000c8U,
	0x00000037U,
	0x0000006dU,
	0x0000008dU,
	0x000000d5U,
	0x0000004eU,
	0x000000a9U,
	0x0000006cU,
	0x00000056U,
	0x000000f4U,
	0x000000eaU,
	0x00000065U,
	0x0000007aU,
	0x000000aeU,
	0x00000008U,
	0x000000baU,
	0x00000078U,
	0x00000025U,
	0x0000002eU,
	0x0000001cU,
	0x000000a6U,
	0x000000b4U,
	0x000000c6U,
	0x000000e8U,
	0x000000ddU,
	0x00000074U,
	0x0000001fU,
	0x0000004bU,
	0x000000bdU,
	0x0000008bU,
	0x0000008aU,
	0x00000070U,
	0x0000003eU,
	0x000000b5U,
	0x00000066U,
	0x00000048U,
	0x00000003U,
	0x000000f6U,
	0x0000000eU,
	0x00000061U,
	0x00000035U,
	0x00000057U,
	0x000000b9U,
	0x00000086U,
	0x000000c1U,
	0x0000001dU,
	0x0000009eU,
	0x000000e1U,
	0x000000f8U,
	0x00000098U,
	0x00000011U,
	0x00000069U,
	0x000000d9U,
	0x0000008eU,
	0x00000094U,
	0x0000009bU,
	0x0000001eU,
	0x00000087U,
	0x000000e9U,
	0x000000ceU,
	0x00000055U,
	0x00000028U,
	0x000000dfU,
	0x0000008cU,
	0x000000a1U,
	0x00000089U,
	0x0000000dU,
	0x000000bfU,
	0x000000e6U,
	0x00000042U,
	0x00000068U,
	0x00000041U,
	0x00000099U,
	0x0000002dU,
	0x0000000fU,
	0x000000b0U,
	0x00000054U,
	0x000000bbU,
	0x00000016U,
};
u32 T4_1[AES_128_TABLE_SIZE] = {
	0x00006300U,
	0x00007c00U,
	0x00007700U,
	0x00007b00U,
	0x0000f200U,
	0x00006b00U,
	0x00006f00U,
	0x0000c500U,
	0x00003000U,
	0x00000100U,
	0x00006700U,
	0x00002b00U,
	0x0000fe00U,
	0x0000d700U,
	0x0000ab00U,
	0x00007600U,
	0x0000ca00U,
	0x00008200U,
	0x0000c900U,
	0x00007d00U,
	0x0000fa00U,
	0x00005900U,
	0x00004700U,
	0x0000f000U,
	0x0000ad00U,
	0x0000d400U,
	0x0000a200U,
	0x0000af00U,
	0x00009c00U,
	0x0000a400U,
	0x00007200U,
	0x0000c000U,
	0x0000b700U,
	0x0000fd00U,
	0x00009300U,
	0x00002600U,
	0x00003600U,
	0x00003f00U,
	0x0000f700U,
	0x0000cc00U,
	0x00003400U,
	0x0000a500U,
	0x0000e500U,
	0x0000f100U,
	0x00007100U,
	0x0000d800U,
	0x00003100U,
	0x00001500U,
	0x00000400U,
	0x0000c700U,
	0x00002300U,
	0x0000c300U,
	0x00001800U,
	0x00009600U,
	0x00000500U,
	0x00009a00U,
	0x00000700U,
	0x00001200U,
	0x00008000U,
	0x0000e200U,
	0x0000eb00U,
	0x00002700U,
	0x0000b200U,
	0x00007500U,
	0x00000900U,
	0x00008300U,
	0x00002c00U,
	0x00001a00U,
	0x00001b00U,
	0x00006e00U,
	0x00005a00U,
	0x0000a000U,
	0x00005200U,
	0x00003b00U,
	0x0000d600U,
	0x0000b300U,
	0x00002900U,
	0x0000e300U,
	0x00002f00U,
	0x00008400U,
	0x00005300U,
	0x0000d100U,
	0x00000000U,
	0x0000ed00U,
	0x00002000U,
	0x0000fc00U,
	0x0000b100U,
	0x00005b00U,
	0x00006a00U,
	0x0000cb00U,
	0x0000be00U,
	0x00003900U,
	0x00004a00U,
	0x00004c00U,
	0x00005800U,
	0x0000cf00U,
	0x0000d000U,
	0x0000ef00U,
	0x0000aa00U,
	0x0000fb00U,
	0x00004300U,
	0x00004d00U,
	0x00003300U,
	0x00008500U,
	0x00004500U,
	0x0000f900U,
	0x00000200U,
	0x00007f00U,
	0x00005000U,
	0x00003c00U,
	0x00009f00U,
	0x0000a800U,
	0x00005100U,
	0x0000a300U,
	0x00004000U,
	0x00008f00U,
	0x00009200U,
	0x00009d00U,
	0x00003800U,
	0x0000f500U,
	0x0000bc00U,
	0x0000b600U,
	0x0000da00U,
	0x00002100U,
	0x00001000U,
	0x0000ff00U,
	0x0000f300U,
	0x0000d200U,
	0x0000cd00U,
	0x00000c00U,
	0x00001300U,
	0x0000ec00U,
	0x00005f00U,
	0x00009700U,
	0x00004400U,
	0x00001700U,
	0x0000c400U,
	0x0000a700U,
	0x00007e00U,
	0x00003d00U,
	0x00006400U,
	0x00005d00U,
	0x00001900U,
	0x00007300U,
	0x00006000U,
	0x00008100U,
	0x00004f00U,
	0x0000dc00U,
	0x00002200U,
	0x00002a00U,
	0x00009000U,
	0x00008800U,
	0x00004600U,
	0x0000ee00U,
	0x0000b800U,
	0x00001400U,
	0x0000de00U,
	0x00005e00U,
	0x00000b00U,
	0x0000db00U,
	0x0000e000U,
	0x00003200U,
	0x00003a00U,
	0x00000a00U,
	0x00004900U,
	0x00000600U,
	0x00002400U,
	0x00005c00U,
	0x0000c200U,
	0x0000d300U,
	0x0000ac00U,
	0x00006200U,
	0x00009100U,
	0x00009500U,
	0x0000e400U,
	0x00007900U,
	0x0000e700U,
	0x0000c800U,
	0x00003700U,
	0x00006d00U,
	0x00008d00U,
	0x0000d500U,
	0x00004e00U,
	0x0000a900U,
	0x00006c00U,
	0x00005600U,
	0x0000f400U,
	0x0000ea00U,
	0x00006500U,
	0x00007a00U,
	0x0000ae00U,
	0x00000800U,
	0x0000ba00U,
	0x00007800U,
	0x00002500U,
	0x00002e00U,
	0x00001c00U,
	0x0000a600U,
	0x0000b400U,
	0x0000c600U,
	0x0000e800U,
	0x0000dd00U,
	0x00007400U,
	0x00001f00U,
	0x00004b00U,
	0x0000bd00U,
	0x00008b00U,
	0x00008a00U,
	0x00007000U,
	0x00003e00U,
	0x0000b500U,
	0x00006600U,
	0x00004800U,
	0x00000300U,
	0x0000f600U,
	0x00000e00U,
	0x00006100U,
	0x00003500U,
	0x00005700U,
	0x0000b900U,
	0x00008600U,
	0x0000c100U,
	0x00001d00U,
	0x00009e00U,
	0x0000e100U,
	0x0000f800U,
	0x00009800U,
	0x00001100U,
	0x00006900U,
	0x0000d900U,
	0x00008e00U,
	0x00009400U,
	0x00009b00U,
	0x00001e00U,
	0x00008700U,
	0x0000e900U,
	0x0000ce00U,
	0x00005500U,
	0x00002800U,
	0x0000df00U,
	0x00008c00U,
	0x0000a100U,
	0x00008900U,
	0x00000d00U,
	0x0000bf00U,
	0x0000e600U,
	0x00004200U,
	0x00006800U,
	0x00004100U,
	0x00009900U,
	0x00002d00U,
	0x00000f00U,
	0x0000b000U,
	0x00005400U,
	0x0000bb00U,
	0x00001600U,
};
u32 T4_2[AES_128_TABLE_SIZE] = {
	0x00630000U,
	0x007c0000U,
	0x00770000U,
	0x007b0000U,
	0x00f20000U,
	0x006b0000U,
	0x006f0000U,
	0x00c50000U,
	0x00300000U,
	0x00010000U,
	0x00670000U,
	0x002b0000U,
	0x00fe0000U,
	0x00d70000U,
	0x00ab0000U,
	0x00760000U,
	0x00ca0000U,
	0x00820000U,
	0x00c90000U,
	0x007d0000U,
	0x00fa0000U,
	0x00590000U,
	0x00470000U,
	0x00f00000U,
	0x00ad0000U,
	0x00d40000U,
	0x00a20000U,
	0x00af0000U,
	0x009c0000U,
	0x00a40000U,
	0x00720000U,
	0x00c00000U,
	0x00b70000U,
	0x00fd0000U,
	0x00930000U,
	0x00260000U,
	0x00360000U,
	0x003f0000U,
	0x00f70000U,
	0x00cc0000U,
	0x00340000U,
	0x00a50000U,
	0x00e50000U,
	0x00f10000U,
	0x00710000U,
	0x00d80000U,
	0x00310000U,
	0x00150000U,
	0x00040000U,
	0x00c70000U,
	0x00230000U,
	0x00c30000U,
	0x00180000U,
	0x00960000U,
	0x00050000U,
	0x009a0000U,
	0x00070000U,
	0x00120000U,
	0x00800000U,
	0x00e20000U,
	0x00eb0000U,
	0x00270000U,
	0x00b20000U,
	0x00750000U,
	0x00090000U,
	0x00830000U,
	0x002c0000U,
	0x001a0000U,
	0x001b0000U,
	0x006e0000U,
	0x005a0000U,
	0x00a00000U,
	0x00520000U,
	0x003b0000U,
	0x00d60000U,
	0x00b30000U,
	0x00290000U,
	0x00e30000U,
	0x002f0000U,
	0x00840000U,
	0x00530000U,
	0x00d10000U,
	0x00000000U,
	0x00ed0000U,
	0x00200000U,
	0x00fc0000U,
	0x00b10000U,
	0x005b0000U,
	0x006a0000U,
	0x00cb0000U,
	0x00be0000U,
	0x00390000U,
	0x004a0000U,
	0x004c0000U,
	0x00580000U,
	0x00cf0000U,
	0x00d00000U,
	0x00ef0000U,
	0x00aa0000U,
	0x00fb0000U,
	0x00430000U,
	0x004d0000U,
	0x00330000U,
	0x00850000U,
	0x00450000U,
	0x00f90000U,
	0x00020000U,
	0x007f0000U,
	0x00500000U,
	0x003c0000U,
	0x009f0000U,
	0x00a80000U,
	0x00510000U,
	0x00a30000U,
	0x00400000U,
	0x008f0000U,
	0x00920000U,
	0x009d0000U,
	0x00380000U,
	0x00f50000U,
	0x00bc0000U,
	0x00b60000U,
	0x00da0000U,
	0x00210000U,
	0x00100000U,
	0x00ff0000U,
	0x00f30000U,
	0x00d20000U,
	0x00cd0000U,
	0x000c0000U,
	0x00130000U,
	0x00ec0000U,
	0x005f0000U,
	0x00970000U,
	0x00440000U,
	0x00170000U,
	0x00c40000U,
	0x00a70000U,
	0x007e0000U,
	0x003d0000U,
	0x00640000U,
	0x005d0000U,
	0x00190000U,
	0x00730000U,
	0x00600000U,
	0x00810000U,
	0x004f0000U,
	0x00dc0000U,
	0x00220000U,
	0x002a0000U,
	0x00900000U,
	0x00880000U,
	0x00460000U,
	0x00ee0000U,
	0x00b80000U,
	0x00140000U,
	0x00de0000U,
	0x005e0000U,
	0x000b0000U,
	0x00db0000U,
	0x00e00000U,
	0x00320000U,
	0x003a0000U,
	0x000a0000U,
	0x00490000U,
	0x00060000U,
	0x00240000U,
	0x005c0000U,
	0x00c20000U,
	0x00d30000U,
	0x00ac0000U,
	0x00620000U,
	0x00910000U,
	0x00950000U,
	0x00e40000U,
	0x00790000U,
	0x00e70000U,
	0x00c80000U,
	0x00370000U,
	0x006d0000U,
	0x008d0000U,
	0x00d50000U,
	0x004e0000U,
	0x00a90000U,
	0x006c0000U,
	0x00560000U,
	0x00f40000U,
	0x00ea0000U,
	0x00650000U,
	0x007a0000U,
	0x00ae0000U,
	0x00080000U,
	0x00ba0000U,
	0x00780000U,
	0x00250000U,
	0x002e0000U,
	0x001c0000U,
	0x00a60000U,
	0x00b40000U,
	0x00c60000U,
	0x00e80000U,
	0x00dd0000U,
	0x00740000U,
	0x001f0000U,
	0x004b0000U,
	0x00bd0000U,
	0x008b0000U,
	0x008a0000U,
	0x00700000U,
	0x003e0000U,
	0x00b50000U,
	0x00660000U,
	0x00480000U,
	0x00030000U,
	0x00f60000U,
	0x000e0000U,
	0x00610000U,
	0x00350000U,
	0x00570000U,
	0x00b90000U,
	0x00860000U,
	0x00c10000U,
	0x001d0000U,
	0x009e0000U,
	0x00e10000U,
	0x00f80000U,
	0x00980000U,
	0x00110000U,
	0x00690000U,
	0x00d90000U,
	0x008e0000U,
	0x00940000U,
	0x009b0000U,
	0x001e0000U,
	0x00870000U,
	0x00e90000U,
	0x00ce0000U,
	0x00550000U,
	0x00280000U,
	0x00df0000U,
	0x008c0000U,
	0x00a10000U,
	0x00890000U,
	0x000d0000U,
	0x00bf0000U,
	0x00e60000U,
	0x00420000U,
	0x00680000U,
	0x00410000U,
	0x00990000U,
	0x002d0000U,
	0x000f0000U,
	0x00b00000U,
	0x00540000U,
	0x00bb0000U,
	0x00160000U,
};
u32 T4_3[AES_128_TABLE_SIZE] = {
	0x63000000U,
	0x7c000000U,
	0x77000000U,
	0x7b000000U,
	0xf2000000U,
	0x6b000000U,
	0x6f000000U,
	0xc5000000U,
	0x30000000U,
	0x01000000U,
	0x67000000U,
	0x2b000000U,
	0xfe000000U,
	0xd7000000U,
	0xab000000U,
	0x76000000U,
	0xca000000U,
	0x82000000U,
	0xc9000000U,
	0x7d000000U,
	0xfa000000U,
	0x59000000U,
	0x47000000U,
	0xf0000000U,
	0xad000000U,
	0xd4000000U,
	0xa2000000U,
	0xaf000000U,
	0x9c000000U,
	0xa4000000U,
	0x72000000U,
	0xc0000000U,
	0xb7000000U,
	0xfd000000U,
	0x93000000U,
	0x26000000U,
	0x36000000U,
	0x3f000000U,
	0xf7000000U,
	0xcc000000U,
	0x34000000U,
	0xa5000000U,
	0xe5000000U,
	0xf1000000U,
	0x71000000U,
	0xd8000000U,
	0x31000000U,
	0x15000000U,
	0x04000000U,
	0xc7000000U,
	0x23000000U,
	0xc3000000U,
	0x18000000U,
	0x96000000U,
	0x05000000U,
	0x9a000000U,
	0x07000000U,
	0x12000000U,
	0x80000000U,
	0xe2000000U,
	0xeb000000U,
	0x27000000U,
	0xb2000000U,
	0x75000000U,
	0x09000000U,
	0x83000000U,
	0x2c000000U,
	0x1a000000U,
	0x1b000000U,
	0x6e000000U,
	0x5a000000U,
	0xa0000000U,
	0x52000000U,
	0x3b000000U,
	0xd6000000U,
	0xb3000000U,
	0x29000000U,
	0xe3000000U,
	0x2f000000U,
	0x84000000U,
	0x53000000U,
	0xd1000000U,
	0x00000000U,
	0xed000000U,
	0x20000000U,
	0xfc000000U,
	0xb1000000U,
	0x5b000000U,
	0x6a000000U,
	0xcb000000U,
	0xbe000000U,
	0x39000000U,
	0x4a000000U,
	0x4c000000U,
	0x58000000U,
	0xcf000000U,
	0xd0000000U,
	0xef000000U,
	0xaa000000U,
	0xfb000000U,
	0x43000000U,
	0x4d000000U,
	0x33000000U,
	0x85000000U,
	0x45000000U,
	0xf9000000U,
	0x02000000U,
	0x7f000000U,
	0x50000000U,
	0x3c000000U,
	0x9f000000U,
	0xa8000000U,
	0x51000000U,
	0xa3000000U,
	0x40000000U,
	0x8f000000U,
	0x92000000U,
	0x9d000000U,
	0x38000000U,
	0xf5000000U,
	0xbc000000U,
	0xb6000000U,
	0xda000000U,
	0x21000000U,
	0x10000000U,
	0xff000000U,
	0xf3000000U,
	0xd2000000U,
	0xcd000000U,
	0x0c000000U,
	0x13000000U,
	0xec000000U,
	0x5f000000U,
	0x97000000U,
	0x44000000U,
	0x17000000U,
	0xc4000000U,
	0xa7000000U,
	0x7e000000U,
	0x3d000000U,
	0x64000000U,
	0x5d000000U,
	0x19000000U,
	0x73000000U,
	0x60000000U,
	0x81000000U,
	0x4f000000U,
	0xdc000000U,
	0x22000000U,
	0x2a000000U,
	0x90000000U,
	0x88000000U,
	0x46000000U,
	0xee000000U,
	0xb8000000U,
	0x14000000U,
	0xde000000U,
	0x5e000000U,
	0x0b000000U,
	0xdb000000U,
	0xe0000000U,
	0x32000000U,
	0x3a000000U,
	0x0a000000U,
	0x49000000U,
	0x06000000U,
	0x24000000U,
	0x5c000000U,
	0xc2000000U,
	0xd3000000U,
	0xac000000U,
	0x62000000U,
	0x91000000U,
	0x95000000U,
	0xe4000000U,
	0x79000000U,
	0xe7000000U,
	0xc8000000U,
	0x37000000U,
	0x6d000000U,
	0x8d000000U,
	0xd5000000U,
	0x4e000000U,
	0xa9000000U,
	0x6c000000U,
	0x56000000U,
	0xf4000000U,
	0xea000000U,
	0x65000000U,
	0x7a000000U,
	0xae000000U,
	0x08000000U,
	0xba000000U,
	0x78000000U,
	0x25000000U,
	0x2e000000U,
	0x1c000000U,
	0xa6000000U,
	0xb4000000U,
	0xc6000000U,
	0xe8000000U,
	0xdd000000U,
	0x74000000U,
	0x1f000000U,
	0x4b000000U,
	0xbd000000U,
	0x8b000000U,
	0x8a000000U,
	0x70000000U,
	0x3e000000U,
	0xb5000000U,
	0x66000000U,
	0x48000000U,
	0x03000000U,
	0xf6000000U,
	0x0e000000U,
	0x61000000U,
	0x35000000U,
	0x57000000U,
	0xb9000000U,
	0x86000000U,
	0xc1000000U,
	0x1d000000U,
	0x9e000000U,
	0xe1000000U,
	0xf8000000U,
	0x98000000U,
	0x11000000U,
	0x69000000U,
	0xd9000000U,
	0x8e000000U,
	0x94000000U,
	0x9b000000U,
	0x1e000000U,
	0x87000000U,
	0xe9000000U,
	0xce000000U,
	0x55000000U,
	0x28000000U,
	0xdf000000U,
	0x8c000000U,
	0xa1000000U,
	0x89000000U,
	0x0d000000U,
	0xbf000000U,
	0xe6000000U,
	0x42000000U,
	0x68000000U,
	0x41000000U,
	0x99000000U,
	0x2d000000U,
	0x0f000000U,
	0xb0000000U,
	0x54000000U,
	0xbb000000U,
	0x16000000U,
};
